function time(ms){
    return new Promise((resolve) => {
        setTimeout(resolve,ms);
    })
}
function currentTime() {
    return ", 时间" + new Date().getSeconds();
}

async function registered(name, calllback) {
    console.log(name + "挂号中", currentTime());
    await time(2000);
    return (4);
}
async function seeDoctor(name, calllback) {
    console.log(name + '正在看医生', currentTime());
    await time(2000);
    return "一包板蓝根";
}
async function takeMedicine(name, callback) {
    console.log(name + "正在拿药", currentTime());
    await time(2000);
}

(async function run(name) {
    let num = await registered(name);
    console.log('挂号成功, 号码牌:', num, currentTime());
    let medicine = await seeDoctor(name);
    console.log('医生要小明拿药: ', medicine, currentTime());
    console.log('拿药成功，看病结束', currentTime());
})('小明');

